The invention relates to selecting a routine based on processing power.
A computer may execute a routine to perform a function. Although the complexity of the routine may improve an output of the function, more complex routines typically require more computations and thus, more processing time by the computer. The processing time required to process the routine may also be a function of the available processing power of the computer.
For example, referring to FIG. 1, a typical digital camera 12 uses a rectangular array of pixel sensors 5 to electrically capture an optical image 11. To accomplish this, a shutter (not shown) of the camera 12 momentarily exposes the image 11 to the sensors 5 for a predetermined exposure time. After the exposure, each sensor 5 indicates an intensity of light from a portion of the image 11.
The camera 12 typically processes these indications to form a frame of data (which digitally represents the captured image) and transfers the frame of data (via a bus 15, for example) to a computer 14 for processing. For video, the camera 12 may capture several optical images and furnish several frames of data, each of which indicates one of the captured images. The computer 14 may then use the frames to recreate captured video on a display 8 or a printer 7.
Each pixel may be represented by several (three, for example) bytes which indicate the color components of the pixel. For example, if the color of each pixel is being represented in a red green blue (RGB) color space, then each pixel may be represented by three bytes: one byte representing the red component, one byte representing the green component and one byte representing the blue component.
Referring to FIG. 2, the computer 14 may process the stream of data to enhance, analyze and restore the images captured by the camera 12. For example, the camera 12 may provide a stream of data that represents an image 17 (only part of the image shown in FIG. 2) having a resolution of 320 columns by 240 rows. However, the computer 14 might desire an image 19 (only part of the image shown in FIG. 2) having a resolution of 640.times.480 and thus, may require a technique called upsampling, or interpolation, to obtain the color components for the additional, or "missing" pixels.
For example, to obtain the color components for pixels of the higher resolution image 19, the computer 14 may perform a 1:2 direct mapping. In this manner, the computer 14 may use the color components of some pixels (pixels 9, for example) of the lower resolution image 17 to obtain color components for pixels (pixels 22a and 22c, for example) of the higher resolution image 19. As a result of this direct mapping, some of the pixels (pixels 22a and 22c, as examples) of the higher resolution image 19 might have the same color components as corresponding pixels (pixels 9, as examples) of the lower resolution image 17.
However, the higher resolution image 19 has approximately twice as many pixels as the lower resolution image 17. As a result, the 1:2 mapping by the computer 14 does not furnish the color components for all pixels of the image 19. To fill in the color components for the remaining pixels, the computer 14 might use a color interpolation technique.
As an example, the computer may interpolate the color components for the pixel 22b by using the color components of pixels 22a and 22c that are adjacent to, or are "neighbors" to, the pixel 22b. In this manner, the computer 14 may average the color components of neighboring pixels 22a and 22c to obtain color components for the pixel 22b.
Generally, the accuracy of the interpolation is a function of the number of neighboring pixels used and the type of interpolation algorithm. For example, in general, an interpolation algorithm that uses two neighboring pixels may not be as accurate as an interpolation algorithm that uses eight neighboring pixels. Also, more accuracy may be achieved if, for example, distances to the neighboring pixels (for the pixel whose color components are being interpolated) are taken into account in the interpolation and if, for example, a nonlinear weighting technique (a spline-based interpolation algorithm, for example) is used.
Although the complexity of the interpolation algorithm may improve the quality of the image 19, in general, more computations are required for a more complex algorithm which, in turn, may require more computer processing time. The processing time may also be a function of the available processing power of the computer 14. For example, a type of processor being used by the computer 14, the operating frequency of the computer 14, and/or a bandwidth of the computer 14 that is available for interpolation processing may all affect the available processing power of the computer 14.
Providers of software for the computer 14 typically select routines (a routine that uses an interpolation algorithm, for example) to accommodate a wide range of processing powers and thus, a wide range of computers. However, by trying to accommodate such a wide range, the quality of data produced by the routine may not be optimized for the available processing power of the computer.
Thus, there is a continuing need for a system which efficiently accommodates computers of varying processing powers.